{extend name="common/menu_child" /}

{block name="nav"}
<span class="layui-breadcrumb">
	<a>资源回收</a>
	<a><cite>工作地区申请表</cite></a>
</span>
{/block}

{block name="body"}
<div class="layui-row">
	<form class="layui-form layui-col-md12 x-so">
		<input class="layui-input" placeholder="姓名" name="realname" value="{$condition.realname}" autocomplete="off" />
		<div class="layui-input-inline">
			<select name="result">
				<option value="">处理结果</option>
				{foreach name="result" item="vo" key="ko"}
				<option value="{$ko}" {heq name="condition.result" value="$ko"}selected{/heq}>{$vo}</option>
				{/foreach}
			</select>
		</div>
		<input style="display:none;" name="p" value="1" />
		<button class="layui-btn"><i class="layui-icon">&#xe615;</i></button>
	</form>
</div>
<table class="layui-table">
	<thead>
		<tr>
			<th>序号</th>
			<th>姓名</th>
			<th>联系电话</th>
			<th>申请地址</th>
			<th>申请时间</th>
			<th>处理结果</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		{eq name="data_list|count" value="0"}
			<tr>
				<td colspan="20">暂无数据</td>
			</tr>
		{else/}
			{foreach name="data_list" item="vo" key="ko"}
			<tr>
				<td>{$ko + 1}</td>
				<td>{$vo.staff_realname}</td>
				<td>{$vo.staff_phone}</td>
				<td>{$vo.region_name}</td>
				<td>{$vo.create_time|date='Y-m-d H:i:s',###}</td>
				<td>{$vo.result_name}</td>
				<td class="td-manage">
					{eq name="vo.result" value="0"}
					<a title="允许" href="javascript:submit_accept({$vo.id});">
						<i class="layui-icon" style="font-size:18px;">&#xe605;</i>
					</a>
					<a title="拒绝" href="javascript:submit_reject({$vo.id});">
						<i class="layui-icon" style="font-size:18px;">&#x1006;</i>
					</a>
					{/eq}
				</td>
			</tr>
			{/foreach}
		{/eq}
	</tbody>
</table>

<div class="page">{$page}</div>
{/block}

{block name="javascript"}
<script type="text/javascript">
	
	function submit_accept(id) {
		
		let data = {
			id: id,
			result: true
		};
		layer.confirm('确定要通过吗？', {}, function(){
			action_post_json('{:url("dispose")}', data, function(response){
				layer.msg(response.message);
				switch(response.errno){
					case 0 :
						setTimeout(function(){
							window.location.reload();
						}, 1000);
						break;
				};
			});
		});
		
	};
	
	function submit_reject(id) {
		
		let data = {
			id: id,
			result: false
		};
		layer.confirm('确定要驳回吗？', {}, function(){
			action_post_json('{:url("dispose")}', data, function(response){
				layer.msg(response.message);
				switch(response.errno){
					case 0 :
						setTimeout(function(){
							window.location.reload();
						}, 1000);
						break;
				};
			});
		});
	};
	
</script>
{/block}